package gw

import (
	"gioui.org/layout"
	"gioui.org/unit"
)

func NewSpacer(dp ...int) layout.FlexChild {
	width := 0
	height := 0
	switch len(dp) {
	case 1:
		height = dp[0]
	case 2:
		width, height = dp[0], dp[1]
	}
	return layout.Rigid(layout.Spacer{Width: unit.Dp(width), Height: unit.Dp(height)}.Layout)
}

func NewSpaceFill(dp ...int) layout.FlexChild {
	return layout.Flexed(1, func(gtx C) D {
		return layout.Dimensions{} // 占位符，用于填充剩余空间
	})
}
